declare namespace CSSLoader {
  // url
  type Url =
    | boolean
    | {
        filter: (url: string, resourcePath: string) => boolean;
      };
  // import
  type ImportFn =
    | boolean
    | {
        filter: (
          url: string,
          media: string,
          resourcePath: string,
          supports?: string,
          layer?: string,
        ) => boolean;
      };
  // modules
  type Modules =
    | boolean
    | "local"
    | "global"
    | "pure"
    | "icss"
    | {
        auto: boolean | RegExp | ((resourcePath: string) => boolean);
        mode:
          | "local"
          | "global"
          | "pure"
          | "icss"
          | ((resourcePath: string) => "local" | "global" | "pure" | "icss");
        localIdentName: string;
        localIdentContext: string;
        localIdentHashSalt: string;
        localIdentHashFunction: string;
        localIdentHashDigest: string;
        localIdentRegExp: string | RegExp;
        getLocalIdent: <T>(
          context: import("webpack").LoaderContext<T>,
          localIdentName: string,
          localName: string,
        ) => string;
        /**
         * @default Option.esModule
         */
        namedExport: boolean;
        exportGlobals: boolean;
        exportLocalsConvention:
          | "as-is"
          | "camel-case"
          | "camel-case-only"
          | "dashes"
          | "dashes-only"
          | ((name: string) => string);
        /**
         * @default false
         */
        exportOnlyLocals: boolean;
        /**
         * @default undefined
         */
        getJSON: ({
          resourcePath,
          imports,
          exports,
          replacements,
        }: {
          resourcePath: string;
          imports: object[];
          exports: object[];
          replacements: object[];
        }) => Promise<void> | void;
      };
  // sourceMap
  type SourceMap = boolean;
  // importLoaders
  type ImportLoaders = number;
  // esModule
  type EsModule = boolean;
  // exportType
  type ExportType = "array" | "string" | "css-style-sheet";

  export type Options = {
    /**
     * @default 'array'
     */
    exportType?: ExportType;
    /**
     * @default 0
     */
    importLoaders?: ImportLoaders;
    /**
     * @default !compiler.devtool || compiler.devtool !== 'eval'
     */
    sourceMap?: SourceMap;
    modules?: Modules;
    import?: ImportFn;
    url?: Url;
    /**
     * @default true
     */
    esModule?: EsModule;
  };
}

declare module "css-loader" {
  export = CSSLoader;
}
